
//
//  HYJudgeOK.m
//  CallsSystemAlbumForIpad
//
//  Created by 上官惠阳 on 16/9/6.
//  Copyright © 2016年 上官惠阳. All rights reserved.
//

#import "HYJudgeOK.h"
#import <AssetsLibrary/AssetsLibrary.h>
#import <AVFoundation/AVCaptureDevice.h>
#import <AVFoundation/AVMediaFormat.h>
#import <UIKit/UIKit.h>

@implementation HYJudgeOK
+(BOOL)cameraOK
{
    AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
    if (authStatus == AVAuthorizationStatusRestricted || authStatus ==AVAuthorizationStatusDenied)
    {
        //无权限
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"无法启动相机" message:@"请为农厂汇开放相机权限：设置->隐私->相机->农厂汇(打开)" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
        [alert show];
        return NO;
    }
    return YES;
}
+(BOOL)AlbumOK
{
    ALAuthorizationStatus author = [ALAssetsLibrary authorizationStatus];
    if (author == ALAuthorizationStatusRestricted || author == ALAuthorizationStatusDenied)
    {
        //无权限
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"无法启用相册" message:@"请为农厂汇开放相册权限：设置->隐私->照片->农厂汇(打开)" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
        [alert show];
        return NO;
    }
    return YES;
}
@end
